<?php
namespace TennisTournament\Persistent;

use TennisTournament\Model\Group;
use TennisTournament\Model\Match;

interface MatchDao extends GenericDao {

    /**
     * Fetch all matches based on their state of tournament
     * @param $stageOfTournament string from {@link StageOfTournamentEnum}
     * @throws LogicException if $stageOfTournament is not one from {@link StageOfTournamentEnum}
     * @return array from all matches or null if doesn't exist such matches
     */
    public function fetchAllWithStageOfTournament($stageOfTournament);

    /**
     * Update Match entity
     * @param Match $match
     * @return void
     */
    public function update(Match $match);

    /**
     * Fetch all matches played in specific Groups
     * @param Group $group
     * @return array | null
     */
    public function getAllMatchesBy(Group $group);

    /**
     * Retrieve all Matches who are played in the current date
     * @param \DateTime $date
     * @return array
     */
    public function getAllMatchesByDate(\DateTime $date);

    /**
     * Check whether all matches in specific stage of tournament are played yet or not.
     * @param $stageOfTournament string
     * @return boolean
     */
    public function isPlayedAllMatchesInStageOfTournament($stageOfTournament);
}